<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Đặng Khánh Trung
 * Date: 11/2/12
 * Time: 11:33 AM
 * To change this template use File | Settings | File Templates.
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();

$hocvis = $this->get('hocvi');
$canbo = $this->get('canbo');
$phongs = $this->get('phong');
if (count($phongs) > 1) 
    $phong = $phongs[0];
elseif (count($phongs) == 1)
    $phong = $phongs;
$donvis = $this->get('donvi');
if (count($donvis) > 1)
    $donvi = $donvis[0];
elseif (count($donvis) == 1)
    $donvi = $donvis;
$khoi = $this->get('khoi');
$hosocanbo = VastHelper::getHosocanbo();
?>

<div id="crumbs">
    <div style="color: #222222;font-weight: normal;margin: 0;padding: 0">
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=vast') ?>">Trang chủ</a> »
        <span>Cơ cấu tổ chức</span> »
        <?php if (isset($khoi)): ?>        
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=donvitructhuoc&id=' . $khoi->id); ?>"><?php echo $khoi->ten ?></a> »                
        <?php endif; ?>
        <?php if (isset($donvi)): ?>
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=phongtructhuocs&id=' . $donvi->id); ?>"><?php echo $donvi->ten ?></a> »
        <?php endif; ?>
        <?php if (isset($phong)): ?>
        <span><?php echo $phong->ten; ?></span> »        
        <?php endif; ?>
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=chitietcanbo&id=' . $canbo->id); ?>"><?php echo $canbo->hoten; ?></a> »
        <span>Xem diễn biến học vị</span>
    </div>
</div>

<div id="main" class="home">
    <h3 class="title green">Tra cứu thông tin diễn biến học vị của cán bộ <?php echo $canbo->hoten; ?></h3>
    
    <div>
        <table id="rounded-corner">
            <thead>
                <tr>
                    <th scope="col" class="rounded-company" style="width: 200px;;"><a href="#ten">Tên</a></th>
                    <th scope="col" class="rounded-q1"><a href="#thoigian">Thời gian</a></th>
                    <th scope="col" class="rounded-q4" style="width: 70px;"><a href="#chucnang">Chức năng</a></th>
                </tr>    
    <!--            <tr>
                    <th scope="col" class="rounded-q1" width="30%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="15%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="15%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="20%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="20%"><input type="text"/></th>
                </tr>-->
            </thead>
            <tfoot>
                <tr>
                    <td colspan="2" class="rounded-foot-left">
                        <em>
                        </em>
                    </td>
                    <td class="rounded-foot-right" style="font-size: smaller;">
                    </td>
                </tr>
            </tfoot>
            <tbody>
                <?php foreach ($hocvis as $item) { ?>
                    <tr>
                        <td><?= $item->ten ?></a></td>
                        <td><?= $item->namdatduoc ?></td>
                        <td style="text-align: center;">
                            <a href="<?php echo JRoute::_('index.php?option=com_vast&view=quanlyhocvi&layout=view&did=' . $item->id . '&id=' . $canbo->id); ?>">
                                <img src="<?php echo $this->baseurl . '/components/com_vast/assets/images/view.png' ?>" />
                            </a>
                            <?php if (JFactory::getUser()->authorise('vast.hosocanbo.edit', 'com_vast') || (JFactory::getUser()->authorise('vast.hosocanbo.edit.own', 'com_vast') && $hosocanbo->nguoidung_id == JFactory::getUser()->id)): ?>    
                            <a href="<?php echo JRoute::_('index.php?option=com_vast&view=dienbienhocvi&layout=edit&did=' . $item->id . '&id=' . $canbo->id); ?>">
                                <img src="<?php echo $this->baseurl . '/components/com_vast/assets/images/update.png' ?>" />                            
                            </a>
                            <?php endif; ?>
                            <?php if (JFactory::getUser()->authorise('vast.hosocanbo.edit', 'com_vast') || (JFactory::getUser()->authorise('vast.hosocanbo.edit.own', 'com_vast') && $hosocanbo->nguoidung_id == JFactory::getUser()->id)): ?>    
                            <a onclick="return confirm('Bạn có chắc chắn muốn xóa thông tin học vị này ?');" href="<?php echo JRoute::_('index.php?option=com_vast&view=dienbienhocvi&task=dienbienhocvi.delete&did=' . $item->id . '&id=' . $item->hosocanbo_id); ?>">
                                <img src="<?php echo $this->baseurl . '/components/com_vast/assets/images/delete.png' ?>" />                            
                            </a>
                            <?php endif; ?>
                        </td>
                    </tr>
                <?php } ?>
            </tbody>
        </table>
    </div>
    <div style="float: left; width: 680px; margin-top: 5px;">
        <?php
        if (isset($_SERVER['HTTP_REFERER']))
        {
            $url = htmlspecialchars($_SERVER['HTTP_REFERER']);
            echo '<a title="Quay lại" href="' . $url . '"><span style="left: 600px; position: relative;">&laquo; Quay lại</span></a>';            
        }
        ?>    
    </div>    
</div>